//package com.iris.storage.service;
//
//import com.aliyun.oss.OSS;
//import com.aliyun.oss.OSSClientBuilder;
//import com.iris.framework.common.exception.ServerException;
//import com.iris.storage.properties.StorageProperties;
//
//import java.io.ByteArrayInputStream;
//import java.io.InputStream;
//
///**
// * 阿里云存储
// *
// * @author 王小费 whx5710@qq.com
// *
// */
//public class AliyunStorageService extends StorageService {
//
//    public AliyunStorageService(StorageProperties properties) {
//        this.properties = properties;
//    }
//
//    @Override
//    public String upload(byte[] data, String path) {
//        return upload(new ByteArrayInputStream(data), path);
//    }
//
//    @Override
//    public String upload(InputStream inputStream, String path) {
//        OSS client = new OSSClientBuilder().build(properties.getAliyun().getEndPoint(),
//                properties.getAliyun().getAccessKeyId(), properties.getAliyun().getAccessKeySecret());
//        try {
//            client.putObject(properties.getAliyun().getBucketName(), path, inputStream);
//        } catch (Exception e) {
//            throw new ServerException("上传文件失败：", e);
//        } finally {
//            if (client != null) {
//                client.shutdown();
//            }
//        }
//
//        return properties.getConfig().getDomain() + "/" + path;
//    }
//
//}
